package com.yanqu.road.entity.voucher;

import com.yanqu.road.entity.DataObject;
import com.yanqu.road.entity.FieldTypeAnnotation;

import java.util.Objects;

@FieldTypeAnnotation(tableName = "t_u_voucher")
public class UserVoucherData extends DataObject {

    @FieldTypeAnnotation(desc = "用户Id", select = true, update = true)
    private long userId;

    @FieldTypeAnnotation(desc = "代金券id", select = true, update = true)
    private long voucherId;

    @FieldTypeAnnotation(desc = "代金券类型")
    private int type;

    @FieldTypeAnnotation(desc = "代金券面值")
    private int price;

    @FieldTypeAnnotation(desc = "代金券兑换码")
    private String code;

    @FieldTypeAnnotation(desc = "代金券有效期")
    private long expireTime;

    public long getUserId() {
        return userId;
    }

    public void setUserId(long userId) {
        if (this.userId != userId) {
            this.userId = userId;
            setUpdateOption();
        }
    }

    public long getVoucherId() {
        return voucherId;
    }

    public void setVoucherId(long voucherId) {
        if (this.voucherId != voucherId) {
            this.voucherId = voucherId;
            setUpdateOption();
        }
    }

    public int getType() {
        return type;
    }

    public void setType(int type) {
        if (this.type != type) {
            this.type = type;
            setUpdateOption();
        }
    }

    public int getPrice() {
        return price;
    }

    public void setPrice(int price) {
        if (this.price != price) {
            this.price = price;
            setUpdateOption();
        }
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        if (!Objects.equals(this.code, code)) {
            this.code = code;
            setUpdateOption();
        }
    }

    public long getExpireTime() {
        return expireTime;
    }

    public void setExpireTime(long expireTime) {
        if (this.expireTime != expireTime) {
            this.expireTime = expireTime;
            setUpdateOption();
        }
    }
}
